<?php
declare(strict_types=1);

namespace SixShop\WechatPay;

use PHPUnit\Framework\TestCase;
use SixShop\WechatPay\Trait\ApiTrait;
use SixShop\WechatPay\Trait\MiniAppTrait;
use WeChatPay\BuilderChainable;

class WechatPayBuilderTest extends TestCase
{
    use MiniAppTrait;

    use ApiTrait;

    public function testCreate()
    {
        $result = \SixShop\WechatPay\Facade\WechatPayBuilder::getBuilderChainable();
        $this->assertInstanceOf(BuilderChainable::class, $result);
    }

    public function testOpSpecialOrder()
    {

        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionCode(268546002);
        $result = $this->opSpecialOrder('errororderid', 2);
    }

    public function testDomesticRefunds()
    {
        $result = $this->domesticRefunds('20250904133148020905', '20250904133148020905', 0.01);
        $this->assertObjectHasProperty('amount', $result);
        dump($result);
    }

    public function testQueryByOutTradeNo()
    {
        $result = $this->queryByOutTradeNo('20250904133148020905');
        dump($result);
    }

    public function testQueryRefund()
    {
        $result = $this->queryRefund('20250909135117037302');
        dump($result);
    }
    public function testQueryTransferBill()
    {
        $result = $this->queryTransferBill('20251105151948049869');
        dump($result);
    }
}